package day12;

import com.sun.org.apache.bcel.internal.generic.IF_ACMPEQ;

import java.util.Scanner;

public class TestComputer {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        Computer a = new Computer();
        SoftWare b = new Sys();
        a.setStart("已关机");
        while (true) {
            System.out.println("1:格式化");
            System.out.println("2:安装操作系统");
            System.out.println("3:启动");
            System.out.println("4:安装软件");
            System.out.println("5:下载软件");
            System.out.println("6:查看各盘情况");
            System.out.println("9:退出");
            System.out.println("请输入您的选择");
            int chioce = input.nextInt();
            switch (chioce) {
                case 1:
                    if (a.getStart().equals("已开机")) {
                        System.out.println("计划分为几个盘");
                        int sum = input.nextInt();

                        for (int i = 0; i < sum; i++) {
                            Disk disk = new Disk();
                            System.out.println("请输入第" + (i + 1) + "个盘符");
                            disk.setType(input.next());
                            System.out.println("请输入" + (i + 1) + "个盘符的大小");
                            disk.setSize(input.nextInt());
                        }
                        System.out.println("格式化成功");

                    } else {
                        System.out.println("电脑未开机请先启动");
                    }
                    a.setFormat("已格式化");
                    break;

                case 2:
                    if (a.getStart().equals("已开机") && a.getFormat().equals("已格式化")) {
                        System.out.println("有以下操作系统可供选择");
                        ((Sys) b).show();
                        Sys sys = new Sys();
                        System.out.println("请输入您的选择");
                        sys.setName(input.next());
                        System.out.println("请输入您要安装的盘符");
                        String h = input.next();
                        a.setup(sys, h);
                        a.setInstall("系统已安装");
                    }
                    break;
                case 3:
                    a.start();
                    a.setStart("已开机");
                    break;

            }
        }
    }
}
